Initial system commit

jamesperet 11 years ago
commit
1b6516fa08
80 changed files with 1972 additions and 0 deletions
  1. 16 0
      .gitignore
  2. 56 0
      Gemfile
  3. 162 0
      Gemfile.lock
  4. 28 0
      README.rdoc
  5. 6 0
      Rakefile
  6. 0 0
      app/assets/images/.keep
  7. 17 0
      app/assets/javascripts/application.js
  8. 3 0
      app/assets/javascripts/bootstrap.js.coffee
  9. 13 0
      app/assets/stylesheets/application.css
  10. 30 0
      app/assets/stylesheets/bootstrap_and_overrides.css.less
  11. 5 0
      app/controllers/application_controller.rb
  12. 0 0
      app/controllers/concerns/.keep
  13. 2 0
      app/helpers/application_helper.rb
  14. 0 0
      app/mailers/.keep
  15. 0 0
      app/models/.keep
  16. 0 0
      app/models/concerns/.keep
  17. 6 0
      app/models/user.rb
  18. 16 0
      app/views/devise/confirmations/new.html.erb
  19. 5 0
      app/views/devise/mailer/confirmation_instructions.html.erb
  20. 8 0
      app/views/devise/mailer/reset_password_instructions.html.erb
  21. 7 0
      app/views/devise/mailer/unlock_instructions.html.erb
  22. 19 0
      app/views/devise/passwords/edit.html.erb
  23. 15 0
      app/views/devise/passwords/new.html.erb
  24. 27 0
      app/views/devise/registrations/edit.html.erb
  25. 17 0
      app/views/devise/registrations/new.html.erb
  26. 15 0
      app/views/devise/sessions/new.html.erb
  27. 25 0
      app/views/devise/shared/_links.erb
  28. 16 0
      app/views/devise/unlocks/new.html.erb
  29. 86 0
      app/views/layouts/application.html.erb
  30. 3 0
      bin/bundle
  31. 4 0
      bin/rails
  32. 4 0
      bin/rake
  33. 4 0
      config.ru
  34. 23 0
      config/application.rb
  35. 4 0
      config/boot.rb
  36. 60 0
      config/database.yml
  37. 5 0
      config/environment.rb
  38. 29 0
      config/environments/development.rb
  39. 80 0
      config/environments/production.rb
  40. 36 0
      config/environments/test.rb
  41. 7 0
      config/initializers/backtrace_silencers.rb
  42. 256 0
      config/initializers/devise.rb
  43. 4 0
      config/initializers/filter_parameter_logging.rb
  44. 88 0
      config/initializers/friendly_id.rb
  45. 16 0
      config/initializers/inflections.rb
  46. 5 0
      config/initializers/mime_types.rb
  47. 12 0
      config/initializers/secret_token.rb
  48. 3 0
      config/initializers/session_store.rb
  49. 145 0
      config/initializers/simple_form.rb
  50. 45 0
      config/initializers/simple_form_bootstrap.rb
  51. 14 0
      config/initializers/wrap_parameters.rb
  52. 59 0
      config/locales/devise.en.yml
  53. 18 0
      config/locales/en.bootstrap.yml
  54. 23 0
      config/locales/en.yml
  55. 26 0
      config/locales/simple_form.en.yml
  56. 57 0
      config/routes.rb
  57. 15 0
      db/migrate/20140821183032_create_friendly_id_slugs.rb
  58. 44 0
      db/migrate/20140821183137_devise_create_users.rb
  59. 52 0
      db/schema.rb
  60. 7 0
      db/seeds.rb
  61. 0 0
      lib/assets/.keep
  62. 0 0
      lib/tasks/.keep
  63. 13 0
      lib/templates/erb/scaffold/_form.html.erb
  64. 0 0
      log/.keep
  65. 58 0
      public/404.html
  66. 58 0
      public/422.html
  67. 57 0
      public/500.html
  68. 0 0
      public/favicon.ico
  69. 5 0
      public/robots.txt
  70. 0 0
      test/controllers/.keep
  71. 0 0
      test/fixtures/.keep
  72. 11 0
      test/fixtures/users.yml
  73. 0 0
      test/helpers/.keep
  74. 0 0
      test/integration/.keep
  75. 0 0
      test/mailers/.keep
  76. 0 0
      test/models/.keep
  77. 7 0
      test/models/user_test.rb
  78. 15 0
      test/test_helper.rb
  79. 0 0
      vendor/assets/javascripts/.keep
  80. 0 0
      vendor/assets/stylesheets/.keep

+ 16 - 0
.gitignore

@@ -0,0 +1,16 @@
1
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+#
3
+# If you find yourself ignoring temporary files generated by your text editor
4
+# or operating system, you probably want to add a global ignore instead:
5
+#   git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+# Ignore bundler config.
8
+/.bundle
9
+
10
+# Ignore the default SQLite database.
11
+/db/*.sqlite3
12
+/db/*.sqlite3-journal
13
+
14
+# Ignore all logfiles and tempfiles.
15
+/log/*.log
16
+/tmp

+ 56 - 0
Gemfile

@@ -0,0 +1,56 @@
1
+source 'https://rubygems.org'
2
+
3
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
+gem 'rails', '4.0.4'
5
+
6
+# Use postgresql as the database for Active Record
7
+gem 'pg'
8
+
9
+# Use SCSS for stylesheets
10
+#gem 'sass-rails', '~> 4.0.2'
11
+
12
+# Use Uglifier as compressor for JavaScript assets
13
+gem 'uglifier', '>= 1.3.0'
14
+
15
+# Use CoffeeScript for .js.coffee assets and views
16
+gem 'coffee-rails', '~> 4.0.0'
17
+
18
+# See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
+# gem 'therubyracer', platforms: :ruby
20
+
21
+# Use jquery as the JavaScript library
22
+gem 'jquery-rails'
23
+
24
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
25
+gem 'turbolinks'
26
+
27
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
28
+gem 'jbuilder', '~> 1.2'
29
+
30
+group :doc do
31
+  # bundle exec rake doc:rails generates the API under doc/api.
32
+  gem 'sdoc', require: false
33
+end
34
+
35
+gem "therubyracer"
36
+gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
37
+gem "twitter-bootstrap-rails"
38
+gem 'flatstrap-rails'
39
+gem 'simple_form'
40
+gem 'friendly_id', '~> 5.0.0'
41
+gem 'devise'
42
+gem "letter_opener", :group => :development
43
+gem 'redcarpet'
44
+gem 'summernote-rails'
45
+
46
+# Use ActiveModel has_secure_password
47
+# gem 'bcrypt', '~> 3.1.7'
48
+
49
+# Use unicorn as the app server
50
+# gem 'unicorn'
51
+
52
+# Use Capistrano for deployment
53
+# gem 'capistrano', group: :development
54
+
55
+# Use debugger
56
+# gem 'debugger', group: [:development, :test]

+ 162 - 0
Gemfile.lock

@@ -0,0 +1,162 @@
1
+GEM
2
+  remote: https://rubygems.org/
3
+  specs:
4
+    actionmailer (4.0.4)
5
+      actionpack (= 4.0.4)
6
+      mail (~> 2.5.4)
7
+    actionpack (4.0.4)
8
+      activesupport (= 4.0.4)
9
+      builder (~> 3.1.0)
10
+      erubis (~> 2.7.0)
11
+      rack (~> 1.5.2)
12
+      rack-test (~> 0.6.2)
13
+    activemodel (4.0.4)
14
+      activesupport (= 4.0.4)
15
+      builder (~> 3.1.0)
16
+    activerecord (4.0.4)
17
+      activemodel (= 4.0.4)
18
+      activerecord-deprecated_finders (~> 1.0.2)
19
+      activesupport (= 4.0.4)
20
+      arel (~> 4.0.0)
21
+    activerecord-deprecated_finders (1.0.3)
22
+    activesupport (4.0.4)
23
+      i18n (~> 0.6, >= 0.6.9)
24
+      minitest (~> 4.2)
25
+      multi_json (~> 1.3)
26
+      thread_safe (~> 0.1)
27
+      tzinfo (~> 0.3.37)
28
+    addressable (2.3.6)
29
+    arel (4.0.2)
30
+    bcrypt (3.1.7)
31
+    builder (3.1.4)
32
+    coffee-rails (4.0.1)
33
+      coffee-script (>= 2.2.0)
34
+      railties (>= 4.0.0, < 5.0)
35
+    coffee-script (2.3.0)
36
+      coffee-script-source
37
+      execjs
38
+    coffee-script-source (1.7.1)
39
+    commonjs (0.2.7)
40
+    devise (3.2.4)
41
+      bcrypt (~> 3.0)
42
+      orm_adapter (~> 0.1)
43
+      railties (>= 3.2.6, < 5)
44
+      thread_safe (~> 0.1)
45
+      warden (~> 1.2.3)
46
+    erubis (2.7.0)
47
+    execjs (2.2.1)
48
+    flatstrap-rails (0.3.0.2)
49
+      twitter-bootstrap-rails (~> 2.2.6)
50
+    friendly_id (5.0.4)
51
+      activerecord (>= 4.0.0)
52
+    hike (1.2.3)
53
+    i18n (0.6.11)
54
+    jbuilder (1.5.3)
55
+      activesupport (>= 3.0.0)
56
+      multi_json (>= 1.2.0)
57
+    jquery-rails (3.1.1)
58
+      railties (>= 3.0, < 5.0)
59
+      thor (>= 0.14, < 2.0)
60
+    json (1.8.1)
61
+    launchy (2.4.2)
62
+      addressable (~> 2.3)
63
+    less (2.5.0)
64
+      commonjs (~> 0.2.7)
65
+    less-rails (2.5.0)
66
+      actionpack (>= 3.1)
67
+      less (~> 2.5.0)
68
+    letter_opener (1.2.0)
69
+      launchy (~> 2.2)
70
+    libv8 (3.16.14.3)
71
+    mail (2.5.4)
72
+      mime-types (~> 1.16)
73
+      treetop (~> 1.4.8)
74
+    mime-types (1.25.1)
75
+    minitest (4.7.5)
76
+    multi_json (1.10.1)
77
+    orm_adapter (0.5.0)
78
+    pg (0.17.1)
79
+    polyglot (0.3.5)
80
+    rack (1.5.2)
81
+    rack-test (0.6.2)
82
+      rack (>= 1.0)
83
+    rails (4.0.4)
84
+      actionmailer (= 4.0.4)
85
+      actionpack (= 4.0.4)
86
+      activerecord (= 4.0.4)
87
+      activesupport (= 4.0.4)
88
+      bundler (>= 1.3.0, < 2.0)
89
+      railties (= 4.0.4)
90
+      sprockets-rails (~> 2.0.0)
91
+    railties (4.0.4)
92
+      actionpack (= 4.0.4)
93
+      activesupport (= 4.0.4)
94
+      rake (>= 0.8.7)
95
+      thor (>= 0.18.1, < 2.0)
96
+    rake (10.3.2)
97
+    rdoc (4.1.1)
98
+      json (~> 1.4)
99
+    redcarpet (3.1.2)
100
+    ref (1.0.5)
101
+    sdoc (0.4.1)
102
+      json (~> 1.7, >= 1.7.7)
103
+      rdoc (~> 4.0)
104
+    simple_form (3.0.2)
105
+      actionpack (~> 4.0)
106
+      activemodel (~> 4.0)
107
+    sprockets (2.11.0)
108
+      hike (~> 1.2)
109
+      multi_json (~> 1.0)
110
+      rack (~> 1.0)
111
+      tilt (~> 1.1, != 1.3.0)
112
+    sprockets-rails (2.0.1)
113
+      actionpack (>= 3.0)
114
+      activesupport (>= 3.0)
115
+      sprockets (~> 2.8)
116
+    summernote-rails (0.4.0)
117
+      railties (>= 3.1)
118
+    therubyracer (0.12.1)
119
+      libv8 (~> 3.16.14.0)
120
+      ref
121
+    thor (0.19.1)
122
+    thread_safe (0.3.4)
123
+    tilt (1.4.1)
124
+    treetop (1.4.15)
125
+      polyglot
126
+      polyglot (>= 0.3.1)
127
+    turbolinks (2.2.3)
128
+      coffee-rails
129
+    twitter-bootstrap-rails (2.2.8)
130
+      actionpack (>= 3.1)
131
+      execjs
132
+      rails (>= 3.1)
133
+      railties (>= 3.1)
134
+    tzinfo (0.3.41)
135
+    uglifier (2.5.3)
136
+      execjs (>= 0.3.0)
137
+      json (>= 1.8.0)
138
+    warden (1.2.3)
139
+      rack (>= 1.0)
140
+
141
+PLATFORMS
142
+  ruby
143
+
144
+DEPENDENCIES
145
+  coffee-rails (~> 4.0.0)
146
+  devise
147
+  flatstrap-rails
148
+  friendly_id (~> 5.0.0)
149
+  jbuilder (~> 1.2)
150
+  jquery-rails
151
+  less-rails
152
+  letter_opener
153
+  pg
154
+  rails (= 4.0.4)
155
+  redcarpet
156
+  sdoc
157
+  simple_form
158
+  summernote-rails
159
+  therubyracer
160
+  turbolinks
161
+  twitter-bootstrap-rails
162
+  uglifier (>= 1.3.0)

+ 28 - 0
README.rdoc

@@ -0,0 +1,28 @@
1
+== README
2
+
3
+This README would normally document whatever steps are necessary to get the
4
+application up and running.
5
+
6
+Things you may want to cover:
7
+
8
+* Ruby version
9
+
10
+* System dependencies
11
+
12
+* Configuration
13
+
14
+* Database creation
15
+
16
+* Database initialization
17
+
18
+* How to run the test suite
19
+
20
+* Services (job queues, cache servers, search engines, etc.)
21
+
22
+* Deployment instructions
23
+
24
+* ...
25
+
26
+
27
+Please feel free to use a different markup language if you do not plan to run
28
+<tt>rake doc:app</tt>.

+ 6 - 0
Rakefile

@@ -0,0 +1,6 @@
1
+# Add your own tasks in files placed in lib/tasks ending in .rake,
2
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+require File.expand_path('../config/application', __FILE__)
5
+
6
+AvalancheGame::Application.load_tasks

+ 0 - 0
app/assets/images/.keep


+ 17 - 0
app/assets/javascripts/application.js

@@ -0,0 +1,17 @@
1
+// This is a manifest file that'll be compiled into application.js, which will include all the files
2
+// listed below.
3
+//
4
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+//
7
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+// compiled file.
9
+//
10
+// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+// about supported directives.
12
+//
13
+//= require jquery
14
+//= require jquery_ujs
15
+//= require twitter/bootstrap
16
+//= require turbolinks
17
+//= require_tree .

+ 3 - 0
app/assets/javascripts/bootstrap.js.coffee

@@ -0,0 +1,3 @@
1
+jQuery ->
2
+  $("a[rel~=popover], .has-popover").popover()
3
+  $("a[rel~=tooltip], .has-tooltip").tooltip()

+ 13 - 0
app/assets/stylesheets/application.css

@@ -0,0 +1,13 @@
1
+/*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */

+ 30 - 0
app/assets/stylesheets/bootstrap_and_overrides.css.less

@@ -0,0 +1,30 @@
1
+@import "twitter/bootstrap/bootstrap";
2
+@import "twitter/bootstrap/responsive";
3
+
4
+// Set the correct sprite paths
5
+@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
6
+@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
7
+
8
+// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
9
+@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
10
+@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
11
+@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
12
+@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
13
+@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
14
+
15
+// Font Awesome
16
+@import "fontawesome/font-awesome";
17
+
18
+// Glyphicons
19
+//@import "twitter/bootstrap/sprites.less";
20
+
21
+// Your custom LESS stylesheets goes here
22
+//
23
+// Since bootstrap was imported above you have access to its mixins which
24
+// you may use and inherit here
25
+//
26
+// If you'd like to override bootstrap's own variables, you can do so here as well
27
+// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
28
+//
29
+// Example:
30
+// @linkColor: #ff0000;

+ 5 - 0
app/controllers/application_controller.rb

@@ -0,0 +1,5 @@
1
+class ApplicationController < ActionController::Base
2
+  # Prevent CSRF attacks by raising an exception.
3
+  # For APIs, you may want to use :null_session instead.
4
+  protect_from_forgery with: :exception
5
+end

+ 0 - 0
app/controllers/concerns/.keep


+ 2 - 0
app/helpers/application_helper.rb

@@ -0,0 +1,2 @@
1
+module ApplicationHelper
2
+end

+ 0 - 0
app/mailers/.keep


+ 0 - 0
app/models/.keep


+ 0 - 0
app/models/concerns/.keep


+ 6 - 0
app/models/user.rb

@@ -0,0 +1,6 @@
1
+class User < ActiveRecord::Base
2
+  # Include default devise modules. Others available are:
3
+  # :confirmable, :lockable, :timeoutable and :omniauthable
4
+  devise :database_authenticatable, :registerable,
5
+         :recoverable, :rememberable, :trackable, :validatable
6
+end

+ 16 - 0
app/views/devise/confirmations/new.html.erb

@@ -0,0 +1,16 @@
1
+<h2>Resend confirmation instructions</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+  <%= f.full_error :confirmation_token %>
6
+
7
+  <div class="form-inputs">
8
+    <%= f.input :email, required: true, autofocus: true %>
9
+  </div>
10
+
11
+  <div class="form-actions">
12
+    <%= f.button :submit, "Resend confirmation instructions" %>
13
+  </div>
14
+<% end %>
15
+
16
+<%= render "devise/shared/links" %>

+ 5 - 0
app/views/devise/mailer/confirmation_instructions.html.erb

@@ -0,0 +1,5 @@
1
+<p>Welcome <%= @email %>!</p>
2
+
3
+<p>You can confirm your account email through the link below:</p>
4
+
5
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

+ 8 - 0
app/views/devise/mailer/reset_password_instructions.html.erb

@@ -0,0 +1,8 @@
1
+<p>Hello <%= @resource.email %>!</p>
2
+
3
+<p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6
+
7
+<p>If you didn't request this, please ignore this email.</p>
8
+<p>Your password won't change until you access the link above and create a new one.</p>

+ 7 - 0
app/views/devise/mailer/unlock_instructions.html.erb

@@ -0,0 +1,7 @@
1
+<p>Hello <%= @resource.email %>!</p>
2
+
3
+<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+<p>Click the link below to unlock your account:</p>
6
+
7
+<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

+ 19 - 0
app/views/devise/passwords/edit.html.erb

@@ -0,0 +1,19 @@
1
+<h2>Change your password</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <%= f.input :reset_password_token, as: :hidden %>
7
+  <%= f.full_error :reset_password_token %>
8
+
9
+  <div class="form-inputs">
10
+    <%= f.input :password, label: "New password", required: true, autofocus: true %>
11
+    <%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
12
+  </div>
13
+
14
+  <div class="form-actions">
15
+    <%= f.button :submit, "Change my password" %>
16
+  </div>
17
+<% end %>
18
+
19
+<%= render "devise/shared/links" %>

+ 15 - 0
app/views/devise/passwords/new.html.erb

@@ -0,0 +1,15 @@
1
+<h2>Forgot your password?</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%= f.button :submit, "Send me reset password instructions" %>
12
+  </div>
13
+<% end %>
14
+
15
+<%= render "devise/shared/links" %>

+ 27 - 0
app/views/devise/registrations/edit.html.erb

@@ -0,0 +1,27 @@
1
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+
9
+    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10
+      <p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
11
+    <% end %>
12
+
13
+    <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
14
+    <%= f.input :password_confirmation, required: false %>
15
+    <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
16
+  </div>
17
+
18
+  <div class="form-actions">
19
+    <%= f.button :submit, "Update" %>
20
+  </div>
21
+<% end %>
22
+
23
+<h3>Cancel my account</h3>
24
+
25
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
26
+
27
+<%= link_to "Back", :back %>

+ 17 - 0
app/views/devise/registrations/new.html.erb

@@ -0,0 +1,17 @@
1
+<h2>Sign up</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+    <%= f.input :password, required: true %>
9
+    <%= f.input :password_confirmation, required: true %>
10
+  </div>
11
+
12
+  <div class="form-actions">
13
+    <%= f.button :submit, "Sign up" %>
14
+  </div>
15
+<% end %>
16
+
17
+<%= render "devise/shared/links" %>

+ 15 - 0
app/views/devise/sessions/new.html.erb

@@ -0,0 +1,15 @@
1
+<h2>Sign in</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
+  <div class="form-inputs">
5
+    <%= f.input :email, required: false, autofocus: true %>
6
+    <%= f.input :password, required: false %>
7
+    <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%= f.button :submit, "Sign in" %>
12
+  </div>
13
+<% end %>
14
+
15
+<%= render "devise/shared/links" %>

+ 25 - 0
app/views/devise/shared/_links.erb

@@ -0,0 +1,25 @@
1
+<%- if controller_name != 'sessions' %>
2
+  <%= link_to "Sign in", new_session_path(resource_name) %><br />
3
+<% end -%>
4
+
5
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+<% end -%>
8
+
9
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+<% end -%>
12
+
13
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+  <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+<% end -%>
16
+
17
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+  <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+<% end -%>
20
+
21
+<%- if devise_mapping.omniauthable? %>
22
+  <%- resource_class.omniauth_providers.each do |provider| %>
23
+    <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24
+  <% end -%>
25
+<% end -%>

+ 16 - 0
app/views/devise/unlocks/new.html.erb

@@ -0,0 +1,16 @@
1
+<h2>Resend unlock instructions</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+  <%= f.full_error :unlock_token %>
6
+
7
+  <div class="form-inputs">
8
+    <%= f.input :email, required: true, autofocus: true %>
9
+  </div>
10
+
11
+  <div class="form-actions">
12
+    <%= f.button :submit, "Resend unlock instructions" %>
13
+  </div>
14
+<% end %>
15
+
16
+<%= render "devise/shared/links" %>

+ 86 - 0
app/views/layouts/application.html.erb

@@ -0,0 +1,86 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+    <title><%= content_for?(:title) ? yield(:title) : "AvalancheGame" %></title>
8
+    <%= csrf_meta_tags %>
9
+
10
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+    <!--[if lt IE 9]>
12
+      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
13
+    <![endif]-->
14
+
15
+    <%= stylesheet_link_tag "application", :media => "all" %>
16
+
17
+    <!-- For third-generation iPad with high-resolution Retina display: -->
18
+    <!-- Size should be 144 x 144 pixels -->
19
+    <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
+
21
+    <!-- For iPhone with high-resolution Retina display: -->
22
+    <!-- Size should be 114 x 114 pixels -->
23
+    <%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
+
25
+    <!-- For first- and second-generation iPad: -->
26
+    <!-- Size should be 72 x 72 pixels -->
27
+    <%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
+
29
+    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
+    <!-- Size should be 57 x 57 pixels -->
31
+    <%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
+
33
+    <!-- For all other devices -->
34
+    <!-- Size should be 32 x 32 pixels -->
35
+    <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36
+
37
+    <%= javascript_include_tag "application" %>
38
+  </head>
39
+  <body>
40
+
41
+    <div class="navbar navbar-fluid-top">
42
+      <div class="navbar-inner">
43
+        <div class="container-fluid">
44
+          <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
45
+            <span class="icon-bar"></span>
46
+            <span class="icon-bar"></span>
47
+            <span class="icon-bar"></span>
48
+          </a>
49
+          <a class="brand" href="#">AvalancheGame</a>
50
+          <div class="container-fluid nav-collapse">
51
+            <ul class="nav">
52
+              <li><%= link_to "Link1", "/path1"  %></li>
53
+              <li><%= link_to "Link2", "/path2"  %></li>
54
+              <li><%= link_to "Link3", "/path3"  %></li>
55
+            </ul>
56
+          </div><!--/.nav-collapse -->
57
+        </div>
58
+      </div>
59
+    </div>
60
+
61
+    <div class="container-fluid">
62
+      <div class="row-fluid">
63
+        <div class="span3">
64
+          <div class="well sidebar-nav">
65
+            <ul class="nav nav-list">
66
+              <li class="nav-header">Sidebar</li>
67
+              <li><%= link_to "Link1", "/path1"  %></li>
68
+              <li><%= link_to "Link2", "/path2"  %></li>
69
+              <li><%= link_to "Link3", "/path3"  %></li>
70
+            </ul>
71
+          </div><!--/.well -->
72
+        </div><!--/span-->
73
+        <div class="span9">
74
+          <%= bootstrap_flash %>
75
+          <%= yield %>
76
+        </div>
77
+      </div><!--/row-->
78
+
79
+      <footer>
80
+        <p>&copy; Company 2014</p>
81
+      </footer>
82
+
83
+    </div> <!-- /container -->
84
+
85
+  </body>
86
+</html>

+ 3 - 0
bin/bundle

@@ -0,0 +1,3 @@
1
+#!/usr/bin/env ruby
2
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+load Gem.bin_path('bundler', 'bundle')

+ 4 - 0
bin/rails

@@ -0,0 +1,4 @@
1
+#!/usr/bin/env ruby
2
+APP_PATH = File.expand_path('../../config/application',  __FILE__)
3
+require_relative '../config/boot'
4
+require 'rails/commands'

+ 4 - 0
bin/rake

@@ -0,0 +1,4 @@
1
+#!/usr/bin/env ruby
2
+require_relative '../config/boot'
3
+require 'rake'
4
+Rake.application.run

+ 4 - 0
config.ru

@@ -0,0 +1,4 @@
1
+# This file is used by Rack-based servers to start the application.
2
+
3
+require ::File.expand_path('../config/environment',  __FILE__)
4
+run Rails.application

+ 23 - 0
config/application.rb

@@ -0,0 +1,23 @@
1
+require File.expand_path('../boot', __FILE__)
2
+
3
+require 'rails/all'
4
+
5
+# Require the gems listed in Gemfile, including any gems
6
+# you've limited to :test, :development, or :production.
7
+Bundler.require(*Rails.groups)
8
+
9
+module AvalancheGame
10
+  class Application < Rails::Application
11
+    # Settings in config/environments/* take precedence over those specified here.
12
+    # Application configuration should go into files in config/initializers
13
+    # -- all .rb files in that directory are automatically loaded.
14
+
15
+    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+    # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+    # config.i18n.default_locale = :de
22
+  end
23
+end

+ 4 - 0
config/boot.rb

@@ -0,0 +1,4 @@
1
+# Set up gems listed in the Gemfile.
2
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

+ 60 - 0
config/database.yml

@@ -0,0 +1,60 @@
1
+# PostgreSQL. Versions 8.2 and up are supported.
2
+#
3
+# Install the pg driver:
4
+#   gem install pg
5
+# On OS X with Homebrew:
6
+#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+# On OS X with MacPorts:
8
+#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+# On Windows:
10
+#   gem install pg
11
+#       Choose the win32 build.
12
+#       Install PostgreSQL and put its /bin directory on your path.
13
+#
14
+# Configure Using Gemfile
15
+# gem 'pg'
16
+#
17
+development:
18
+  adapter: postgresql
19
+  encoding: unicode
20
+  database: avalanche_game_development
21
+  pool: 5
22
+  username: avalanche_game
23
+  password:
24
+
25
+  # Connect on a TCP socket. Omitted by default since the client uses a
26
+  # domain socket that doesn't need configuration. Windows does not have
27
+  # domain sockets, so uncomment these lines.
28
+  #host: localhost
29
+
30
+  # The TCP port the server listens on. Defaults to 5432.
31
+  # If your server runs on a different port number, change accordingly.
32
+  #port: 5432
33
+
34
+  # Schema search path. The server defaults to $user,public
35
+  #schema_search_path: myapp,sharedapp,public
36
+
37
+  # Minimum log levels, in increasing order:
38
+  #   debug5, debug4, debug3, debug2, debug1,
39
+  #   log, notice, warning, error, fatal, and panic
40
+  # Defaults to warning.
41
+  #min_messages: notice
42
+
43
+# Warning: The database defined as "test" will be erased and
44
+# re-generated from your development database when you run "rake".
45
+# Do not set this db to the same as development or production.
46
+test:
47
+  adapter: postgresql
48
+  encoding: unicode
49
+  database: avalanche_game_test
50
+  pool: 5
51
+  username: avalanche_game
52
+  password:
53
+
54
+production:
55
+  adapter: postgresql
56
+  encoding: unicode
57
+  database: avalanche_game_production
58
+  pool: 5
59
+  username: avalanche_game
60
+  password:

+ 5 - 0
config/environment.rb

@@ -0,0 +1,5 @@
1
+# Load the Rails application.
2
+require File.expand_path('../application', __FILE__)
3
+
4
+# Initialize the Rails application.
5
+AvalancheGame::Application.initialize!

+ 29 - 0
config/environments/development.rb

@@ -0,0 +1,29 @@
1
+AvalancheGame::Application.configure do
2
+  # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+  # In the development environment your application's code is reloaded on
5
+  # every request. This slows down response time but is perfect for development
6
+  # since you don't have to restart the web server when you make code changes.
7
+  config.cache_classes = false
8
+
9
+  # Do not eager load code on boot.
10
+  config.eager_load = false
11
+
12
+  # Show full error reports and disable caching.
13
+  config.consider_all_requests_local       = true
14
+  config.action_controller.perform_caching = false
15
+
16
+  # Don't care if the mailer can't send.
17
+  config.action_mailer.raise_delivery_errors = false
18
+
19
+  # Print deprecation notices to the Rails logger.
20
+  config.active_support.deprecation = :log
21
+
22
+  # Raise an error on page load if there are pending migrations
23
+  config.active_record.migration_error = :page_load
24
+
25
+  # Debug mode disables concatenation and preprocessing of assets.
26
+  # This option may cause significant delays in view rendering with a large
27
+  # number of complex assets.
28
+  config.assets.debug = true
29
+end

+ 80 - 0
config/environments/production.rb

@@ -0,0 +1,80 @@
1
+AvalancheGame::Application.configure do
2
+  # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+  # Code is not reloaded between requests.
5
+  config.cache_classes = true
6
+
7
+  # Eager load code on boot. This eager loads most of Rails and
8
+  # your application in memory, allowing both thread web servers
9
+  # and those relying on copy on write to perform better.
10
+  # Rake tasks automatically ignore this option for performance.
11
+  config.eager_load = true
12
+
13
+  # Full error reports are disabled and caching is turned on.
14
+  config.consider_all_requests_local       = false
15
+  config.action_controller.perform_caching = true
16
+
17
+  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+  # Add `rack-cache` to your Gemfile before enabling this.
19
+  # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+  # config.action_dispatch.rack_cache = true
21
+
22
+  # Disable Rails's static asset server (Apache or nginx will already do this).
23
+  config.serve_static_assets = false
24
+
25
+  # Compress JavaScripts and CSS.
26
+  config.assets.js_compressor = :uglifier
27
+  # config.assets.css_compressor = :sass
28
+
29
+  # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+  config.assets.compile = false
31
+
32
+  # Generate digests for assets URLs.
33
+  config.assets.digest = true
34
+
35
+  # Version of your assets, change this if you want to expire all your assets.
36
+  config.assets.version = '1.0'
37
+
38
+  # Specifies the header that your server uses for sending files.
39
+  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+  # config.force_ssl = true
44
+
45
+  # Set to :debug to see everything in the log.
46
+  config.log_level = :info
47
+
48
+  # Prepend all log lines with the following tags.
49
+  # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+  # Use a different logger for distributed setups.
52
+  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+  # Use a different cache store in production.
55
+  # config.cache_store = :mem_cache_store
56
+
57
+  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+  # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+  # Precompile additional assets.
61
+  # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+  # config.assets.precompile += %w( search.js )
63
+
64
+  # Ignore bad email addresses and do not raise email delivery errors.
65
+  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+  # config.action_mailer.raise_delivery_errors = false
67
+
68
+  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+  # the I18n.default_locale when a translation can not be found).
70
+  config.i18n.fallbacks = true
71
+
72
+  # Send deprecation notices to registered listeners.
73
+  config.active_support.deprecation = :notify
74
+
75
+  # Disable automatic flushing of the log to improve performance.
76
+  # config.autoflush_log = false
77
+
78
+  # Use default logging formatter so that PID and timestamp are not suppressed.
79
+  config.log_formatter = ::Logger::Formatter.new
80
+end

+ 36 - 0
config/environments/test.rb

@@ -0,0 +1,36 @@
1
+AvalancheGame::Application.configure do
2
+  # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+  # The test environment is used exclusively to run your application's
5
+  # test suite. You never need to work with it otherwise. Remember that
6
+  # your test database is "scratch space" for the test suite and is wiped
7
+  # and recreated between test runs. Don't rely on the data there!
8
+  config.cache_classes = true
9
+
10
+  # Do not eager load code on boot. This avoids loading your whole application
11
+  # just for the purpose of running a single test. If you are using a tool that
12
+  # preloads Rails for running tests, you may have to set it to true.
13
+  config.eager_load = false
14
+
15
+  # Configure static asset server for tests with Cache-Control for performance.
16
+  config.serve_static_assets  = true
17
+  config.static_cache_control = "public, max-age=3600"
18
+
19
+  # Show full error reports and disable caching.
20
+  config.consider_all_requests_local       = true
21
+  config.action_controller.perform_caching = false
22
+
23
+  # Raise exceptions instead of rendering exception templates.
24
+  config.action_dispatch.show_exceptions = false
25
+
26
+  # Disable request forgery protection in test environment.
27
+  config.action_controller.allow_forgery_protection = false
28
+
29
+  # Tell Action Mailer not to deliver emails to the real world.
30
+  # The :test delivery method accumulates sent emails in the
31
+  # ActionMailer::Base.deliveries array.
32
+  config.action_mailer.delivery_method = :test
33
+
34
+  # Print deprecation notices to the stderr.
35
+  config.active_support.deprecation = :stderr
36
+end

+ 7 - 0
config/initializers/backtrace_silencers.rb

@@ -0,0 +1,7 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+# Rails.backtrace_cleaner.remove_silencers!

+ 256 - 0
config/initializers/devise.rb

@@ -0,0 +1,256 @@
1
+# Use this hook to configure devise mailer, warden hooks and so forth.
2
+# Many of these configuration options can be set straight in your model.
3
+Devise.setup do |config|
4
+  # The secret key used by Devise. Devise uses this key to generate
5
+  # random tokens. Changing this key will render invalid all existing
6
+  # confirmation, reset password and unlock tokens in the database.
7
+  # config.secret_key = '009192d104073de217e451812a7e286c2cd339d56dfe5ed305c0f06e04dea9f032c325fdc6b5aaf6d4bf459830078210385e1cc65b7a4c692fdb9ea77008b33a'
8
+
9
+  # ==> Mailer Configuration
10
+  # Configure the e-mail address which will be shown in Devise::Mailer,
11
+  # note that it will be overwritten if you use your own mailer class
12
+  # with default "from" parameter.
13
+  config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14
+
15
+  # Configure the class responsible to send e-mails.
16
+  # config.mailer = 'Devise::Mailer'
17
+
18
+  # ==> ORM configuration
19
+  # Load and configure the ORM. Supports :active_record (default) and
20
+  # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+  # available as additional gems.
22
+  require 'devise/orm/active_record'
23
+
24
+  # ==> Configuration for any authentication mechanism
25
+  # Configure which keys are used when authenticating a user. The default is
26
+  # just :email. You can configure it to use [:username, :subdomain], so for
27
+  # authenticating a user, both parameters are required. Remember that those
28
+  # parameters are used only when authenticating and not when retrieving from
29
+  # session. If you need permissions, you should implement that in a before filter.
30
+  # You can also supply a hash where the value is a boolean determining whether
31
+  # or not authentication should be aborted when the value is not present.
32
+  # config.authentication_keys = [ :email ]
33
+
34
+  # Configure parameters from the request object used for authentication. Each entry
35
+  # given should be a request method and it will automatically be passed to the
36
+  # find_for_authentication method and considered in your model lookup. For instance,
37
+  # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+  # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+  # config.request_keys = []
40
+
41
+  # Configure which authentication keys should be case-insensitive.
42
+  # These keys will be downcased upon creating or modifying a user and when used
43
+  # to authenticate or find a user. Default is :email.
44
+  config.case_insensitive_keys = [ :email ]
45
+
46
+  # Configure which authentication keys should have whitespace stripped.
47
+  # These keys will have whitespace before and after removed upon creating or
48
+  # modifying a user and when used to authenticate or find a user. Default is :email.
49
+  config.strip_whitespace_keys = [ :email ]
50
+
51
+  # Tell if authentication through request.params is enabled. True by default.
52
+  # It can be set to an array that will enable params authentication only for the
53
+  # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+  # enable it only for database (email + password) authentication.
55
+  # config.params_authenticatable = true
56
+
57
+  # Tell if authentication through HTTP Auth is enabled. False by default.
58
+  # It can be set to an array that will enable http authentication only for the
59
+  # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+  # enable it only for database authentication. The supported strategies are:
61
+  # :database      = Support basic authentication with authentication key + password
62
+  # config.http_authenticatable = false
63
+
64
+  # If http headers should be returned for AJAX requests. True by default.
65
+  # config.http_authenticatable_on_xhr = true
66
+
67
+  # The realm used in Http Basic Authentication. 'Application' by default.
68
+  # config.http_authentication_realm = 'Application'
69
+
70
+  # It will change confirmation, password recovery and other workflows
71
+  # to behave the same regardless if the e-mail provided was right or wrong.
72
+  # Does not affect registerable.
73
+  # config.paranoid = true
74
+
75
+  # By default Devise will store the user in session. You can skip storage for
76
+  # particular strategies by setting this option.
77
+  # Notice that if you are skipping storage for all authentication paths, you
78
+  # may want to disable generating routes to Devise's sessions controller by
79
+  # passing skip: :sessions to `devise_for` in your config/routes.rb
80
+  config.skip_session_storage = [:http_auth]
81
+
82
+  # By default, Devise cleans up the CSRF token on authentication to
83
+  # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+  # requests for sign in and sign up, you need to get a new CSRF token
85
+  # from the server. You can disable this option at your own risk.
86
+  # config.clean_up_csrf_token_on_authentication = true
87
+
88
+  # ==> Configuration for :database_authenticatable
89
+  # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
+  # using other encryptors, it sets how many times you want the password re-encrypted.
91
+  #
92
+  # Limiting the stretches to just one in testing will increase the performance of
93
+  # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
+  # a value less than 10 in other environments. Note that, for bcrypt (the default
95
+  # encryptor), the cost increases exponentially with the number of stretches (e.g.
96
+  # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
97
+  config.stretches = Rails.env.test? ? 1 : 10
98
+
99
+  # Setup a pepper to generate the encrypted password.
100
+  # config.pepper = '0fbb86e4160a2a795e71c056c45af6114f89d40cee7a3a3d57801c95fb956bc9fd3a2a4e628ee4d247947d4d628cb8fb4b36939cce178e0b62c97ae95826425f'
101
+
102
+  # ==> Configuration for :confirmable
103
+  # A period that the user is allowed to access the website even without
104
+  # confirming their account. For instance, if set to 2.days, the user will be
105
+  # able to access the website for two days without confirming their account,
106
+  # access will be blocked just in the third day. Default is 0.days, meaning
107
+  # the user cannot access the website without confirming their account.
108
+  # config.allow_unconfirmed_access_for = 2.days
109
+
110
+  # A period that the user is allowed to confirm their account before their
111
+  # token becomes invalid. For example, if set to 3.days, the user can confirm
112
+  # their account within 3 days after the mail was sent, but on the fourth day
113
+  # their account can't be confirmed with the token any more.
114
+  # Default is nil, meaning there is no restriction on how long a user can take
115
+  # before confirming their account.
116
+  # config.confirm_within = 3.days
117
+
118
+  # If true, requires any email changes to be confirmed (exactly the same way as
119
+  # initial account confirmation) to be applied. Requires additional unconfirmed_email
120
+  # db field (see migrations). Until confirmed, new email is stored in
121
+  # unconfirmed_email column, and copied to email column on successful confirmation.
122
+  config.reconfirmable = true
123
+
124
+  # Defines which key will be used when confirming an account
125
+  # config.confirmation_keys = [ :email ]
126
+
127
+  # ==> Configuration for :rememberable
128
+  # The time the user will be remembered without asking for credentials again.
129
+  # config.remember_for = 2.weeks
130
+
131
+  # If true, extends the user's remember period when remembered via cookie.
132
+  # config.extend_remember_period = false
133
+
134
+  # Options to be passed to the created cookie. For instance, you can set
135
+  # secure: true in order to force SSL only cookies.
136
+  # config.rememberable_options = {}
137
+
138
+  # ==> Configuration for :validatable
139
+  # Range for password length.
140
+  config.password_length = 8..128
141
+
142
+  # Email regex used to validate email formats. It simply asserts that
143
+  # one (and only one) @ exists in the given string. This is mainly
144
+  # to give user feedback and not to assert the e-mail validity.
145
+  # config.email_regexp = /\A[^@]+@[^@]+\z/
146
+
147
+  # ==> Configuration for :timeoutable
148
+  # The time you want to timeout the user session without activity. After this
149
+  # time the user will be asked for credentials again. Default is 30 minutes.
150
+  # config.timeout_in = 30.minutes
151
+
152
+  # If true, expires auth token on session timeout.
153
+  # config.expire_auth_token_on_timeout = false
154
+
155
+  # ==> Configuration for :lockable
156
+  # Defines which strategy will be used to lock an account.
157
+  # :failed_attempts = Locks an account after a number of failed attempts to sign in.
158
+  # :none            = No lock strategy. You should handle locking by yourself.
159
+  # config.lock_strategy = :failed_attempts
160
+
161
+  # Defines which key will be used when locking and unlocking an account
162
+  # config.unlock_keys = [ :email ]
163
+
164
+  # Defines which strategy will be used to unlock an account.
165
+  # :email = Sends an unlock link to the user email
166
+  # :time  = Re-enables login after a certain amount of time (see :unlock_in below)
167
+  # :both  = Enables both strategies
168
+  # :none  = No unlock strategy. You should handle unlocking by yourself.
169
+  # config.unlock_strategy = :both
170
+
171
+  # Number of authentication tries before locking an account if lock_strategy
172
+  # is failed attempts.
173
+  # config.maximum_attempts = 20
174
+
175
+  # Time interval to unlock the account if :time is enabled as unlock_strategy.
176
+  # config.unlock_in = 1.hour
177
+
178
+  # Warn on the last attempt before the account is locked.
179
+  # config.last_attempt_warning = false
180
+
181
+  # ==> Configuration for :recoverable
182
+  #
183
+  # Defines which key will be used when recovering the password for an account
184
+  # config.reset_password_keys = [ :email ]
185
+
186
+  # Time interval you can reset your password with a reset password key.
187
+  # Don't put a too small interval or your users won't have the time to
188
+  # change their passwords.
189
+  config.reset_password_within = 6.hours
190
+
191
+  # ==> Configuration for :encryptable
192
+  # Allow you to use another encryption algorithm besides bcrypt (default). You can use
193
+  # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
194
+  # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
195
+  # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
196
+  # REST_AUTH_SITE_KEY to pepper).
197
+  #
198
+  # Require the `devise-encryptable` gem when using anything other than bcrypt
199
+  # config.encryptor = :sha512
200
+
201
+  # ==> Scopes configuration
202
+  # Turn scoped views on. Before rendering "sessions/new", it will first check for
203
+  # "users/sessions/new". It's turned off by default because it's slower if you
204
+  # are using only default views.
205
+  # config.scoped_views = false
206
+
207
+  # Configure the default scope given to Warden. By default it's the first
208
+  # devise role declared in your routes (usually :user).
209
+  # config.default_scope = :user
210
+
211
+  # Set this configuration to false if you want /users/sign_out to sign out
212
+  # only the current scope. By default, Devise signs out all scopes.
213
+  # config.sign_out_all_scopes = true
214
+
215
+  # ==> Navigation configuration
216
+  # Lists the formats that should be treated as navigational. Formats like
217
+  # :html, should redirect to the sign in page when the user does not have
218
+  # access, but formats like :xml or :json, should return 401.
219
+  #
220
+  # If you have any extra navigational formats, like :iphone or :mobile, you
221
+  # should add them to the navigational formats lists.
222
+  #
223
+  # The "*/*" below is required to match Internet Explorer requests.
224
+  # config.navigational_formats = ['*/*', :html]
225
+
226
+  # The default HTTP method used to sign out a resource. Default is :delete.
227
+  config.sign_out_via = :delete
228
+
229
+  # ==> OmniAuth
230
+  # Add a new OmniAuth provider. Check the wiki for more information on setting
231
+  # up on your models and hooks.
232
+  # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
233
+
234
+  # ==> Warden configuration
235
+  # If you want to use other strategies, that are not supported by Devise, or
236
+  # change the failure app, you can configure them inside the config.warden block.
237
+  #
238
+  # config.warden do |manager|
239
+  #   manager.intercept_401 = false
240
+  #   manager.default_strategies(scope: :user).unshift :some_external_strategy
241
+  # end
242
+
243
+  # ==> Mountable engine configurations
244
+  # When using Devise inside an engine, let's call it `MyEngine`, and this engine
245
+  # is mountable, there are some extra configurations to be taken into account.
246
+  # The following options are available, assuming the engine is mounted as:
247
+  #
248
+  #     mount MyEngine, at: '/my_engine'
249
+  #
250
+  # The router that invoked `devise_for`, in the example above, would be:
251
+  # config.router_name = :my_engine
252
+  #
253
+  # When using omniauth, Devise cannot automatically set Omniauth path,
254
+  # so you need to do it manually. For the users scope, it would be:
255
+  # config.omniauth_path_prefix = '/my_engine/users/auth'
256
+end

+ 4 - 0
config/initializers/filter_parameter_logging.rb

@@ -0,0 +1,4 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# Configure sensitive parameters which will be filtered from the log file.
4
+Rails.application.config.filter_parameters += [:password]

+ 88 - 0
config/initializers/friendly_id.rb

@@ -0,0 +1,88 @@
1
+# FriendlyId Global Configuration
2
+#
3
+# Use this to set up shared configuration options for your entire application.
4
+# Any of the configuration options shown here can also be applied to single
5
+# models by passing arguments to the `friendly_id` class method or defining
6
+# methods in your model.
7
+#
8
+# To learn more, check out the guide:
9
+#
10
+# http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+FriendlyId.defaults do |config|
13
+  # ## Reserved Words
14
+  #
15
+  # Some words could conflict with Rails's routes when used as slugs, or are
16
+  # undesirable to allow as slugs. Edit this list as needed for your app.
17
+  config.use :reserved
18
+
19
+  config.reserved_words = %w(new edit index session login logout users admin
20
+    stylesheets assets javascripts images)
21
+
22
+  #  ## Friendly Finders
23
+  #
24
+  # Uncomment this to use friendly finders in all models. By default, if
25
+  # you wish to find a record by its friendly id, you must do:
26
+  #
27
+  #    MyModel.friendly.find('foo')
28
+  #
29
+  # If you uncomment this, you can do:
30
+  #
31
+  #    MyModel.find('foo')
32
+  #
33
+  # This is significantly more convenient but may not be appropriate for
34
+  # all applications, so you must explicity opt-in to this behavior. You can
35
+  # always also configure it on a per-model basis if you prefer.
36
+  #
37
+  # Something else to consider is that using the :finders addon boosts
38
+  # performance because it will avoid Rails-internal code that makes runtime
39
+  # calls to `Module.extend`.
40
+  #
41
+  # config.use :finders
42
+  #
43
+  # ## Slugs
44
+  #
45
+  # Most applications will use the :slugged module everywhere. If you wish
46
+  # to do so, uncomment the following line.
47
+  #
48
+  # config.use :slugged
49
+  #
50
+  # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+  # 'slug', but you can change it if you wish.
52
+  #
53
+  # config.slug_column = 'slug'
54
+  #
55
+  # When FriendlyId can not generate a unique ID from your base method, it appends
56
+  # a UUID, separated by a single dash. You can configure the character used as the
57
+  # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+  # with two dashes.
59
+  #
60
+  # config.sequence_separator = '-'
61
+  #
62
+  #  ## Tips and Tricks
63
+  #
64
+  #  ### Controlling when slugs are generated
65
+  #
66
+  # As of FriendlyId 5.0, new slugs are generated only when the slug field is
67
+  # nil, but if you're using a column as your base method can change this
68
+  # behavior by overriding the `should_generate_new_friendly_id` method that
69
+  # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
70
+  # more like 4.0.
71
+  #
72
+  # config.use Module.new {
73
+  #   def should_generate_new_friendly_id?
74
+  #     slug.blank? || <your_column_name_here>_changed?
75
+  #   end
76
+  # }
77
+  #
78
+  # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
79
+  # languages that don't use the Roman alphabet, that's not usually suffient. Here
80
+  # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
81
+  # you use this, don't forget to add "babosa" to your Gemfile.
82
+  #
83
+  # config.use Module.new {
84
+  #   def normalize_friendly_id(text)
85
+  #     text.to_slug.normalize! :transliterations => [:russian, :latin]
86
+  #   end
87
+  # }
88
+end

+ 16 - 0
config/initializers/inflections.rb

@@ -0,0 +1,16 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# Add new inflection rules using the following format. Inflections
4
+# are locale specific, and you may define rules for as many different
5
+# locales as you wish. All of these examples are active by default:
6
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+#   inflect.plural /^(ox)$/i, '\1en'
8
+#   inflect.singular /^(ox)en/i, '\1'
9
+#   inflect.irregular 'person', 'people'
10
+#   inflect.uncountable %w( fish sheep )
11
+# end
12
+
13
+# These inflection rules are supported but not enabled by default:
14
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+#   inflect.acronym 'RESTful'
16
+# end

+ 5 - 0
config/initializers/mime_types.rb

@@ -0,0 +1,5 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# Add new mime types for use in respond_to blocks:
4
+# Mime::Type.register "text/richtext", :rtf
5
+# Mime::Type.register_alias "text/html", :iphone

+ 12 - 0
config/initializers/secret_token.rb

@@ -0,0 +1,12 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# Your secret key is used for verifying the integrity of signed cookies.
4
+# If you change this key, all old signed cookies will become invalid!
5
+
6
+# Make sure the secret is at least 30 characters and all random,
7
+# no regular words or you'll be exposed to dictionary attacks.
8
+# You can use `rake secret` to generate a secure secret key.
9
+
10
+# Make sure your secret_key_base is kept private
11
+# if you're sharing your code publicly.
12
+AvalancheGame::Application.config.secret_key_base = '979754400e0f78d27bbc3832a55e4606d5b3f310d9f83cd90086422f6dc8bdc63ac7fd5d8750af66eaca58cc3fe491a76979b108272587d734fa369f6e4380b3'

+ 3 - 0
config/initializers/session_store.rb

@@ -0,0 +1,3 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+AvalancheGame::Application.config.session_store :cookie_store, key: '_avalanche_game_session'

+ 145 - 0
config/initializers/simple_form.rb

@@ -0,0 +1,145 @@
1
+# Use this setup block to configure all options available in SimpleForm.
2
+SimpleForm.setup do |config|
3
+  # Wrappers are used by the form builder to generate a
4
+  # complete input. You can remove any component from the
5
+  # wrapper, change the order or even add your own to the
6
+  # stack. The options given below are used to wrap the
7
+  # whole input.
8
+  config.wrappers :default, class: :input,
9
+    hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
+    ## Extensions enabled by default
11
+    # Any of these extensions can be disabled for a
12
+    # given input by passing: `f.input EXTENSION_NAME => false`.
13
+    # You can make any of these extensions optional by
14
+    # renaming `b.use` to `b.optional`.
15
+
16
+    # Determines whether to use HTML5 (:email, :url, ...)
17
+    # and required attributes
18
+    b.use :html5
19
+
20
+    # Calculates placeholders automatically from I18n
21
+    # You can also pass a string as f.input placeholder: "Placeholder"
22
+    b.use :placeholder
23
+
24
+    ## Optional extensions
25
+    # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+    # to the input. If so, they will retrieve the values from the model
27
+    # if any exists. If you want to enable the lookup for any of those
28
+    # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+    # Calculates maxlength from length validations for string inputs
31
+    b.optional :maxlength
32
+
33
+    # Calculates pattern from format validations for string inputs
34
+    b.optional :pattern
35
+
36
+    # Calculates min and max from length validations for numeric inputs
37
+    b.optional :min_max
38
+
39
+    # Calculates readonly automatically from readonly attributes
40
+    b.optional :readonly
41
+
42
+    ## Inputs
43
+    b.use :label_input
44
+    b.use :hint,  wrap_with: { tag: :span, class: :hint }
45
+    b.use :error, wrap_with: { tag: :span, class: :error }
46
+  end
47
+
48
+  # The default wrapper to be used by the FormBuilder.
49
+  config.default_wrapper = :default
50
+
51
+  # Define the way to render check boxes / radio buttons with labels.
52
+  # Defaults to :nested for bootstrap config.
53
+  #   inline: input + label
54
+  #   nested: label > input
55
+  config.boolean_style = :nested
56
+
57
+  # Default class for buttons
58
+  config.button_class = 'btn'
59
+
60
+  # Method used to tidy up errors. Specify any Rails Array method.
61
+  # :first lists the first message for each field.
62
+  # Use :to_sentence to list all errors for each field.
63
+  # config.error_method = :first
64
+
65
+  # Default tag used for error notification helper.
66
+  config.error_notification_tag = :div
67
+
68
+  # CSS class to add for error notification helper.
69
+  config.error_notification_class = 'alert alert-error'
70
+
71
+  # ID to add for error notification helper.
72
+  # config.error_notification_id = nil
73
+
74
+  # Series of attempts to detect a default label method for collection.
75
+  # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+  # Series of attempts to detect a default value method for collection.
78
+  # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+  # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+  # config.collection_wrapper_tag = nil
82
+
83
+  # You can define the class to use on all collection wrappers. Defaulting to none.
84
+  # config.collection_wrapper_class = nil
85
+
86
+  # You can wrap each item in a collection of radio/check boxes with a tag,
87
+  # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+  # SimpleForm will force this option to be a label.
89
+  # config.item_wrapper_tag = :span
90
+
91
+  # You can define a class to use in all item wrappers. Defaulting to none.
92
+  # config.item_wrapper_class = nil
93
+
94
+  # How the label text should be generated altogether with the required text.
95
+  # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+  # You can define the class to use on all labels. Default is nil.
98
+  config.label_class = 'control-label'
99
+
100
+  # You can define the class to use on all forms. Default is simple_form.
101
+  # config.form_class = :simple_form
102
+
103
+  # You can define which elements should obtain additional classes
104
+  # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+  # Whether attributes are required by default (or not). Default is true.
107
+  # config.required_by_default = true
108
+
109
+  # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+  # These validations are enabled in SimpleForm's internal config but disabled by default
111
+  # in this configuration, which is recommended due to some quirks from different browsers.
112
+  # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+  # change this configuration to true.
114
+  config.browser_validations = false
115
+
116
+  # Collection of methods to detect if a file type was given.
117
+  # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+  # Custom mappings for input types. This should be a hash containing a regexp
120
+  # to match as key, and the input type that will be used when the field name
121
+  # matches the regexp as value.
122
+  # config.input_mappings = { /count/ => :integer }
123
+
124
+  # Custom wrappers for input types. This should be a hash containing an input
125
+  # type as key and the wrapper that will be used for all inputs with specified type.
126
+  # config.wrapper_mappings = { string: :prepend }
127
+
128
+  # Default priority for time_zone inputs.
129
+  # config.time_zone_priority = nil
130
+
131
+  # Default priority for country inputs.
132
+  # config.country_priority = nil
133
+
134
+  # When false, do not use translations for labels.
135
+  # config.translate_labels = true
136
+
137
+  # Automatically discover new inputs in Rails' autoload path.
138
+  # config.inputs_discovery = true
139
+
140
+  # Cache SimpleForm inputs discovery
141
+  # config.cache_discovery = !Rails.env.development?
142
+
143
+  # Default class for inputs
144
+  # config.input_class = nil
145
+end

+ 45 - 0
config/initializers/simple_form_bootstrap.rb

@@ -0,0 +1,45 @@
1
+# Use this setup block to configure all options available in SimpleForm.
2
+SimpleForm.setup do |config|
3
+  config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
4
+    b.use :html5
5
+    b.use :placeholder
6
+    b.use :label
7
+    b.wrapper tag: 'div', class: 'controls' do |ba|
8
+      ba.use :input
9
+      ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
10
+      ba.use :hint,  wrap_with: { tag: 'p', class: 'help-block' }
11
+    end
12
+  end
13
+
14
+  config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
15
+    b.use :html5
16
+    b.use :placeholder
17
+    b.use :label
18
+    b.wrapper tag: 'div', class: 'controls' do |input|
19
+      input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
20
+        prepend.use :input
21
+      end
22
+      input.use :hint,  wrap_with: { tag: 'span', class: 'help-block' }
23
+      input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
24
+    end
25
+  end
26
+
27
+  config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
28
+    b.use :html5
29
+    b.use :placeholder
30
+    b.use :label
31
+    b.wrapper tag: 'div', class: 'controls' do |input|
32
+      input.wrapper tag: 'div', class: 'input-append' do |append|
33
+        append.use :input
34
+      end
35
+      input.use :hint,  wrap_with: { tag: 'span', class: 'help-block' }
36
+      input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
37
+    end
38
+  end
39
+
40
+  # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
41
+  # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
42
+  # to learn about the different styles for forms and inputs,
43
+  # buttons and other elements.
44
+  config.default_wrapper = :bootstrap
45
+end

+ 14 - 0
config/initializers/wrap_parameters.rb

@@ -0,0 +1,14 @@
1
+# Be sure to restart your server when you modify this file.
2
+
3
+# This file contains settings for ActionController::ParamsWrapper which
4
+# is enabled by default.
5
+
6
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ActiveSupport.on_load(:action_controller) do
8
+  wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+end
10
+
11
+# To enable root element in JSON for ActiveRecord objects.
12
+# ActiveSupport.on_load(:active_record) do
13
+#  self.include_root_in_json = true
14
+# end

+ 59 - 0
config/locales/devise.en.yml

@@ -0,0 +1,59 @@
1
+# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+en:
4
+  devise:
5
+    confirmations:
6
+      confirmed: "Your account was successfully confirmed."
7
+      send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+    failure:
10
+      already_authenticated: "You are already signed in."
11
+      inactive: "Your account is not activated yet."
12
+      invalid: "Invalid email or password."
13
+      locked: "Your account is locked."
14
+      last_attempt: "You have one more attempt before your account will be locked."
15
+      not_found_in_database: "Invalid email or password."
16
+      timeout: "Your session expired. Please sign in again to continue."
17
+      unauthenticated: "You need to sign in or sign up before continuing."
18
+      unconfirmed: "You have to confirm your account before continuing."
19
+    mailer:
20
+      confirmation_instructions:
21
+        subject: "Confirmation instructions"
22
+      reset_password_instructions:
23
+        subject: "Reset password instructions"
24
+      unlock_instructions:
25
+        subject: "Unlock Instructions"
26
+    omniauth_callbacks:
27
+      failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+      success: "Successfully authenticated from %{kind} account."
29
+    passwords:
30
+      no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+      send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+      send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+      updated: "Your password was changed successfully. You are now signed in."
34
+      updated_not_active: "Your password was changed successfully."
35
+    registrations:
36
+      destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+      signed_up: "Welcome! You have signed up successfully."
38
+      signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+      signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+      signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+      update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+      updated: "You updated your account successfully."
43
+    sessions:
44
+      signed_in: "Signed in successfully."
45
+      signed_out: "Signed out successfully."
46
+    unlocks:
47
+      send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+      send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+      unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+  errors:
51
+    messages:
52
+      already_confirmed: "was already confirmed, please try signing in"
53
+      confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+      expired: "has expired, please request a new one"
55
+      not_found: "not found"
56
+      not_locked: "was not locked"
57
+      not_saved:
58
+        one: "1 error prohibited this %{resource} from being saved:"
59
+        other: "%{count} errors prohibited this %{resource} from being saved:"

+ 18 - 0
config/locales/en.bootstrap.yml

@@ -0,0 +1,18 @@
1
+# Sample localization file for English. Add more files in this directory for other locales.
2
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+en:
5
+  helpers:
6
+    actions: "Actions"
7
+    links:
8
+      back: "Back"
9
+      cancel: "Cancel"
10
+      confirm: "Are you sure?"
11
+      destroy: "Delete"
12
+      new: "New"
13
+      edit: "Edit"
14
+    titles:
15
+      edit: "Edit %{model}"
16
+      save: "Save %{model}"
17
+      new: "New %{model}"
18
+      delete: "Delete %{model}"

+ 23 - 0
config/locales/en.yml

@@ -0,0 +1,23 @@
1
+# Files in the config/locales directory are used for internationalization
2
+# and are automatically loaded by Rails. If you want to use locales other
3
+# than English, add the necessary files in this directory.
4
+#
5
+# To use the locales, use `I18n.t`:
6
+#
7
+#     I18n.t 'hello'
8
+#
9
+# In views, this is aliased to just `t`:
10
+#
11
+#     <%= t('hello') %>
12
+#
13
+# To use a different locale, set it with `I18n.locale`:
14
+#
15
+#     I18n.locale = :es
16
+#
17
+# This would use the information in config/locales/es.yml.
18
+#
19
+# To learn more, please read the Rails Internationalization guide
20
+# available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+en:
23
+  hello: "Hello world"

+ 26 - 0
config/locales/simple_form.en.yml

@@ -0,0 +1,26 @@
1
+en:
2
+  simple_form:
3
+    "yes": 'Yes'
4
+    "no": 'No'
5
+    required:
6
+      text: 'required'
7
+      mark: '*'
8
+      # You can uncomment the line below if you need to overwrite the whole required html.
9
+      # When using html, text and mark won't be used.
10
+      # html: '<abbr title="required">*</abbr>'
11
+    error_notification:
12
+      default_message: "Please review the problems below:"
13
+    # Labels and hints examples
14
+    # labels:
15
+    #   defaults:
16
+    #     password: 'Password'
17
+    #   user:
18
+    #     new:
19
+    #       email: 'E-mail to sign in.'
20
+    #     edit:
21
+    #       email: 'E-mail.'
22
+    # hints:
23
+    #   defaults:
24
+    #     username: 'User name to sign in.'
25
+    #     password: 'No special characters, please.'
26
+

+ 57 - 0
config/routes.rb

@@ -0,0 +1,57 @@
1
+AvalancheGame::Application.routes.draw do
2
+  devise_for :users
3
+  # The priority is based upon order of creation: first created -> highest priority.
4
+  # See how all your routes lay out with "rake routes".
5
+
6
+  # You can have the root of your site routed with "root"
7
+  # root 'welcome#index'
8
+
9
+  # Example of regular route:
10
+  #   get 'products/:id' => 'catalog#view'
11
+
12
+  # Example of named route that can be invoked with purchase_url(id: product.id)
13
+  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
14
+
15
+  # Example resource route (maps HTTP verbs to controller actions automatically):
16
+  #   resources :products
17
+
18
+  # Example resource route with options:
19
+  #   resources :products do
20
+  #     member do
21
+  #       get 'short'
22
+  #       post 'toggle'
23
+  #     end
24
+  #
25
+  #     collection do
26
+  #       get 'sold'
27
+  #     end
28
+  #   end
29
+
30
+  # Example resource route with sub-resources:
31
+  #   resources :products do
32
+  #     resources :comments, :sales
33
+  #     resource :seller
34
+  #   end
35
+
36
+  # Example resource route with more complex sub-resources:
37
+  #   resources :products do
38
+  #     resources :comments
39
+  #     resources :sales do
40
+  #       get 'recent', on: :collection
41
+  #     end
42
+  #   end
43
+
44
+  # Example resource route with concerns:
45
+  #   concern :toggleable do
46
+  #     post 'toggle'
47
+  #   end
48
+  #   resources :posts, concerns: :toggleable
49
+  #   resources :photos, concerns: :toggleable
50
+
51
+  # Example resource route within a namespace:
52
+  #   namespace :admin do
53
+  #     # Directs /admin/products/* to Admin::ProductsController
54
+  #     # (app/controllers/admin/products_controller.rb)
55
+  #     resources :products
56
+  #   end
57
+end

+ 15 - 0
db/migrate/20140821183032_create_friendly_id_slugs.rb

@@ -0,0 +1,15 @@
1
+class CreateFriendlyIdSlugs < ActiveRecord::Migration
2
+  def change
3
+    create_table :friendly_id_slugs do |t|
4
+      t.string   :slug,           :null => false
5
+      t.integer  :sluggable_id,   :null => false
6
+      t.string   :sluggable_type, :limit => 50
7
+      t.string   :scope
8
+      t.datetime :created_at
9
+    end
10
+    add_index :friendly_id_slugs, :sluggable_id
11
+    add_index :friendly_id_slugs, [:slug, :sluggable_type]
12
+    add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true
13
+    add_index :friendly_id_slugs, :sluggable_type
14
+  end
15
+end

+ 44 - 0
db/migrate/20140821183137_devise_create_users.rb

@@ -0,0 +1,44 @@
1
+class DeviseCreateUsers < ActiveRecord::Migration
2
+  def change
3
+    create_table(:users) do |t|
4
+      ## Database authenticatable
5
+      t.string :email,              null: false, default: ""
6
+      t.string :encrypted_password, null: false, default: ""
7
+
8
+      ## Recoverable
9
+      t.string   :reset_password_token
10
+      t.datetime :reset_password_sent_at
11
+
12
+      ## Rememberable
13
+      t.datetime :remember_created_at
14
+
15
+      ## Trackable
16
+      t.integer  :sign_in_count, default: 0, null: false
17
+      t.datetime :current_sign_in_at
18
+      t.datetime :last_sign_in_at
19
+      t.string   :current_sign_in_ip
20
+      t.string   :last_sign_in_ip
21
+
22
+      ## Confirmable
23
+      # t.string   :confirmation_token
24
+      # t.datetime :confirmed_at
25
+      # t.datetime :confirmation_sent_at
26
+      # t.string   :unconfirmed_email # Only if using reconfirmable
27
+
28
+      ## Lockable
29
+      # t.integer  :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+      # t.string   :unlock_token # Only if unlock strategy is :email or :both
31
+      # t.datetime :locked_at
32
+
33
+      t.string :username
34
+      t.string :location
35
+
36
+      t.timestamps
37
+    end
38
+
39
+    add_index :users, :email,                unique: true
40
+    add_index :users, :reset_password_token, unique: true
41
+    # add_index :users, :confirmation_token,   unique: true
42
+    # add_index :users, :unlock_token,         unique: true
43
+  end
44
+end

+ 52 - 0
db/schema.rb

@@ -0,0 +1,52 @@
1
+# encoding: UTF-8
2
+# This file is auto-generated from the current state of the database. Instead
3
+# of editing this file, please use the migrations feature of Active Record to
4
+# incrementally modify your database, and then regenerate this schema definition.
5
+#
6
+# Note that this schema.rb definition is the authoritative source for your
7
+# database schema. If you need to create the application database on another
8
+# system, you should be using db:schema:load, not running all the migrations
9
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+# you'll amass, the slower it'll run and the greater likelihood for issues).
11
+#
12
+# It's strongly recommended that you check this file into your version control system.
13
+
14
+ActiveRecord::Schema.define(version: 20140821183137) do
15
+
16
+  # These are extensions that must be enabled in order to support this database
17
+  enable_extension "plpgsql"
18
+
19
+  create_table "friendly_id_slugs", force: true do |t|
20
+    t.string   "slug",                      null: false
21
+    t.integer  "sluggable_id",              null: false
22
+    t.string   "sluggable_type", limit: 50
23
+    t.string   "scope"
24
+    t.datetime "created_at"
25
+  end
26
+
27
+  add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
28
+  add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
29
+  add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
30
+  add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
31
+
32
+  create_table "users", force: true do |t|
33
+    t.string   "email",                  default: "", null: false
34
+    t.string   "encrypted_password",     default: "", null: false
35
+    t.string   "reset_password_token"
36
+    t.datetime "reset_password_sent_at"
37
+    t.datetime "remember_created_at"
38
+    t.integer  "sign_in_count",          default: 0,  null: false
39
+    t.datetime "current_sign_in_at"
40
+    t.datetime "last_sign_in_at"
41
+    t.string   "current_sign_in_ip"
42
+    t.string   "last_sign_in_ip"
43
+    t.string   "username"
44
+    t.string   "location"
45
+    t.datetime "created_at"
46
+    t.datetime "updated_at"
47
+  end
48
+
49
+  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
50
+  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
51
+
52
+end

+ 7 - 0
db/seeds.rb

@@ -0,0 +1,7 @@
1
+# This file should contain all the record creation needed to seed the database with its default values.
2
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+#
4
+# Examples:
5
+#
6
+#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+#   Mayor.create(name: 'Emanuel', city: cities.first)

+ 0 - 0
lib/assets/.keep


+ 0 - 0
lib/tasks/.keep


+ 13 - 0
lib/templates/erb/scaffold/_form.html.erb

@@ -0,0 +1,13 @@
1
+<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2
+  <%%= f.error_notification %>
3
+
4
+  <div class="form-inputs">
5
+  <%- attributes.each do |attribute| -%>
6
+    <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7
+  <%- end -%>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%%= f.button :submit %>
12
+  </div>
13
+<%% end %>

+ 0 - 0
log/.keep


+ 58 - 0
public/404.html

@@ -0,0 +1,58 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <title>The page you were looking for doesn't exist (404)</title>
5
+  <style>
6
+  body {
7
+    background-color: #EFEFEF;
8
+    color: #2E2F30;
9
+    text-align: center;
10
+    font-family: arial, sans-serif;
11
+  }
12
+
13
+  div.dialog {
14
+    width: 25em;
15
+    margin: 4em auto 0 auto;
16
+    border: 1px solid #CCC;
17
+    border-right-color: #999;
18
+    border-left-color: #999;
19
+    border-bottom-color: #BBB;
20
+    border-top: #B00100 solid 4px;
21
+    border-top-left-radius: 9px;
22
+    border-top-right-radius: 9px;
23
+    background-color: white;
24
+    padding: 7px 4em 0 4em;
25
+  }
26
+
27
+  h1 {
28
+    font-size: 100%;
29
+    color: #730E15;
30
+    line-height: 1.5em;
31
+  }
32
+
33
+  body > p {
34
+    width: 33em;
35
+    margin: 0 auto 1em;
36
+    padding: 1em 0;
37
+    background-color: #F7F7F7;
38
+    border: 1px solid #CCC;
39
+    border-right-color: #999;
40
+    border-bottom-color: #999;
41
+    border-bottom-left-radius: 4px;
42
+    border-bottom-right-radius: 4px;
43
+    border-top-color: #DADADA;
44
+    color: #666;
45
+    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+  }
47
+  </style>
48
+</head>
49
+
50
+<body>
51
+  <!-- This file lives in public/404.html -->
52
+  <div class="dialog">
53
+    <h1>The page you were looking for doesn't exist.</h1>
54
+    <p>You may have mistyped the address or the page may have moved.</p>
55
+  </div>
56
+  <p>If you are the application owner check the logs for more information.</p>
57
+</body>
58
+</html>

+ 58 - 0
public/422.html

@@ -0,0 +1,58 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <title>The change you wanted was rejected (422)</title>
5
+  <style>
6
+  body {
7
+    background-color: #EFEFEF;
8
+    color: #2E2F30;
9
+    text-align: center;
10
+    font-family: arial, sans-serif;
11
+  }
12
+
13
+  div.dialog {
14
+    width: 25em;
15
+    margin: 4em auto 0 auto;
16
+    border: 1px solid #CCC;
17
+    border-right-color: #999;
18
+    border-left-color: #999;
19
+    border-bottom-color: #BBB;
20
+    border-top: #B00100 solid 4px;
21
+    border-top-left-radius: 9px;
22
+    border-top-right-radius: 9px;
23
+    background-color: white;
24
+    padding: 7px 4em 0 4em;
25
+  }
26
+
27
+  h1 {
28
+    font-size: 100%;
29
+    color: #730E15;
30
+    line-height: 1.5em;
31
+  }
32
+
33
+  body > p {
34
+    width: 33em;
35
+    margin: 0 auto 1em;
36
+    padding: 1em 0;
37
+    background-color: #F7F7F7;
38
+    border: 1px solid #CCC;
39
+    border-right-color: #999;
40
+    border-bottom-color: #999;
41
+    border-bottom-left-radius: 4px;
42
+    border-bottom-right-radius: 4px;
43
+    border-top-color: #DADADA;
44
+    color: #666;
45
+    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+  }
47
+  </style>
48
+</head>
49
+
50
+<body>
51
+  <!-- This file lives in public/422.html -->
52
+  <div class="dialog">
53
+    <h1>The change you wanted was rejected.</h1>
54
+    <p>Maybe you tried to change something you didn't have access to.</p>
55
+  </div>
56
+  <p>If you are the application owner check the logs for more information.</p>
57
+</body>
58
+</html>

+ 57 - 0
public/500.html

@@ -0,0 +1,57 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <title>We're sorry, but something went wrong (500)</title>
5
+  <style>
6
+  body {
7
+    background-color: #EFEFEF;
8
+    color: #2E2F30;
9
+    text-align: center;
10
+    font-family: arial, sans-serif;
11
+  }
12
+
13
+  div.dialog {
14
+    width: 25em;
15
+    margin: 4em auto 0 auto;
16
+    border: 1px solid #CCC;
17
+    border-right-color: #999;
18
+    border-left-color: #999;
19
+    border-bottom-color: #BBB;
20
+    border-top: #B00100 solid 4px;
21
+    border-top-left-radius: 9px;
22
+    border-top-right-radius: 9px;
23
+    background-color: white;
24
+    padding: 7px 4em 0 4em;
25
+  }
26
+
27
+  h1 {
28
+    font-size: 100%;
29
+    color: #730E15;
30
+    line-height: 1.5em;
31
+  }
32
+
33
+  body > p {
34
+    width: 33em;
35
+    margin: 0 auto 1em;
36
+    padding: 1em 0;
37
+    background-color: #F7F7F7;
38
+    border: 1px solid #CCC;
39
+    border-right-color: #999;
40
+    border-bottom-color: #999;
41
+    border-bottom-left-radius: 4px;
42
+    border-bottom-right-radius: 4px;
43
+    border-top-color: #DADADA;
44
+    color: #666;
45
+    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+  }
47
+  </style>
48
+</head>
49
+
50
+<body>
51
+  <!-- This file lives in public/500.html -->
52
+  <div class="dialog">
53
+    <h1>We're sorry, but something went wrong.</h1>
54
+  </div>
55
+  <p>If you are the application owner check the logs for more information.</p>
56
+</body>
57
+</html>

+ 0 - 0
public/favicon.ico


+ 5 - 0
public/robots.txt

@@ -0,0 +1,5 @@
1
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
+#
3
+# To ban all spiders from the entire site uncomment the next two lines:
4
+# User-agent: *
5
+# Disallow: /

+ 0 - 0
test/controllers/.keep


+ 0 - 0
test/fixtures/.keep


+ 11 - 0
test/fixtures/users.yml

@@ -0,0 +1,11 @@
1
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+# This model initially had no columns defined.  If you add columns to the
4
+# model remove the '{}' from the fixture names and add the columns immediately
5
+# below each fixture, per the syntax in the comments below
6
+#
7
+one: {}
8
+# column: value
9
+#
10
+two: {}
11
+#  column: value

+ 0 - 0
test/helpers/.keep


+ 0 - 0
test/integration/.keep


+ 0 - 0
test/mailers/.keep


+ 0 - 0
test/models/.keep


+ 7 - 0
test/models/user_test.rb

@@ -0,0 +1,7 @@
1
+require 'test_helper'
2
+
3
+class UserTest < ActiveSupport::TestCase
4
+  # test "the truth" do
5
+  #   assert true
6
+  # end
7
+end

+ 15 - 0
test/test_helper.rb

@@ -0,0 +1,15 @@
1
+ENV["RAILS_ENV"] ||= "test"
2
+require File.expand_path('../../config/environment', __FILE__)
3
+require 'rails/test_help'
4
+
5
+class ActiveSupport::TestCase
6
+  ActiveRecord::Migration.check_pending!
7
+
8
+  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9
+  #
10
+  # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+  # -- they do not yet inherit this setting
12
+  fixtures :all
13
+
14
+  # Add more helper methods to be used by all tests here...
15
+end

+ 0 - 0
vendor/assets/javascripts/.keep


+ 0 - 0
vendor/assets/stylesheets/.keep